package com.iyundao.io.mapper;

import com.iyundao.io.model.IntegralRecord;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface IntegralRecordMapper {
    @Insert({
        "insert into integralrecord (id, partymemberid, ",
        "integralrecordnum, integralrecordtime, ",
        "activityid, giftid, ",
        "userid)",
        "values (#{id,jdbcType=INTEGER}, #{partymemberid,jdbcType=INTEGER}, ",
        "#{integralrecordnum,jdbcType=INTEGER}, #{integralrecordtime,jdbcType=TIMESTAMP}, ",
        "#{activityid,jdbcType=INTEGER}, #{giftid,jdbcType=INTEGER}, ",
        "#{userid,jdbcType=INTEGER})"
    })
    int insert(IntegralRecord record);

    @InsertProvider(type= IntegralRecordSqlProvider.class, method="insertSelective")
    int insertSelective(IntegralRecord record);

    @Select("select * from integralrecord where partymemberid=#{partymemberid,jdbcType=INTEGER}")
    List<IntegralRecord> selectByPartyMemberId(Integer partymemberid);
}